package com.zmn.oms.zmn.business.interfaces.pay;

import com.zmn.oms.common.dro.orderpay.OrderPayResultDRO;
import com.zmn.oms.common.dto.OmsRefundRequestDTO;
import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.model.dto.order.pay.DuplicatePayRefundDTO;
import com.zmn.oms.model.dto.work.refund.RefundDTO;
import com.zmn.oms.model.dto.work.refund.RefundVoucherDTO;
import com.zmn.oms.model.entity.pay.OrderPay;
import com.zmn.pay.common.dto.PayResultDTO;
import com.zmn.pay.gateway.common.model.dro.RefundResultDRO;

import java.util.List;

/**
 * @author ：SongWeidong
 * @date ：2021/3/31 18:59
 * @description：支付记录
 */
public interface OrderPayBService {

    /**
     * 通过orderId查询支付记录
     * @param orderId
     * @return
     */
    List<OrderPay> listOrderPayByOrderId(Long orderId);

    /**
     * 保存支付记录（pay）
     * @param payResultDTO
     * @return
     */
    void insertOrderPay(PayResultDTO payResultDTO);

    /**
     * 保存支付记录
     * @param orderPayResultDRO
     * @param duplicateType
     * @return
     */
    void insertOrderPay(OrderPayResultDRO orderPayResultDRO, Integer duplicateType);

    /**
     * 重复支付退款，发起退款
     *
     * @param dto
     */
    void duplicatePayRefund(DuplicatePayRefundDTO dto);

    /**
     * 重复支付退款审批
     *
     * @param dto
     */
    boolean duplicatePayRefundApprove(DuplicatePayRefundDTO dto);

    /**
     * 新增原路返回退款记录
     *
     * @param refundResultDRO  退款结果
     * @param refundRequestDTO 退款业务数据
     */
    void insertRefundOrderPay(RefundResultDRO refundResultDRO, OmsRefundRequestDTO refundRequestDTO);

    /**
     * 保存线下退款
     * @param orderId
     * @param workId
     * @param refundStatus
     * @param refundDTO
     */
    void saveOfflineRefund(Long orderId, Long workId, Integer refundStatus, RefundDTO refundDTO);

    void saveRefundVoucher(RefundVoucherDTO refundVoucherDTO) throws OmsBaseException;

    /**
     * 定金或进度款重复支付判断
     * @param orderPayResultDRO
     * @return
     */
    Integer depositAndProgressAmountDuplicationOrderPay(OrderPayResultDRO orderPayResultDRO);

    /**
     * 平台代收和工程师收款重复支付判断
     * @param orderPayResultDRO
     * @return
     */
    Integer prepayAndMasterAmountDuplicationOrderPay(OrderPayResultDRO orderPayResultDRO);

    /**
     * 优惠和渠道收款重复支付
     * @param orderPayResultDRO
     * @return
     */
    Integer channelPrepayAndDiscountAmountDuplicationOrderPay(OrderPayResultDRO orderPayResultDRO);
}
